home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 25
/
Cream of the Crop 25.iso
/
os2
/
srefv12i.zip
/
postrcrd.80
< prev
next >
Wrap
Text File
|
1996-12-31
|
3KB
|
95 lines
/* a simple "event specific" client&request info recorder
This will record clientname and other information when certain
events happen. These events are the transferal of a file,
or the request for a URL. To specify which events, add entries
to the EVENTS. stem variable. These should have the form:
EVENTS.m = ' type value putfile '
where:
Type: FILE or URL -- check the USED_FILE or the URL (the SEL)
value: If the FILE or URL matches the value (wildcard matches okay), then
save information
putfile: Fully qualified file name (results will be written there )
Example:
events.1=' file d:\www\zoo\tigers.htm d:\goserve\tigers.lst '
events.2=' url members\renewal.htm d:\users\incoming\renew.in '
events.3=' url staff\* d:\staff\wwwbiz.log'
events.0=3
Notes:
Make sure you set EVENTS.0 (in this case, EVENTS.0=3) !
All matches will be honored -- more then one "recording" may occur.
**/
postrcrd:
CRLF = '0d0a'x
/* ============== INSERT EVENTS list here ================ */
events.0=0
/* ============ DO NOT CHANGE BELOW HERE ===================== */
parse arg amessage,source,request,sel,tempfile,SERVERNAME,HOST_NICKNAME,used_file,thereferer,tcache
sel=packur(sel) ; request=packur(request)
parse var source serveraddr serverport transaction_number clientaddr clientport
do mm=1 to events.0
parse upper var events.mm type avalue afile
type=strip(type); avalue=strip(avalue); afile=strip(afile)
select
when type='FILE' then do
ares=sref_wildcard(strip(upper(used_file)),strip(avalue),0)
parse var ares astat "," .
if astat=0 then iterate /* no match */
end
when type='URL' | type='SEL' then do
avalue=translate(avalue,'/','\')
ares=sref_wildcard(strip(upper(sel)),strip(avalue),0)
parse var ares astat "," .
if astat=0 then iterate /* no match */
end
otherwise do
call pmprintf(' Error in post-filter recorder. Bad Event entry: ' events.mm)
iterate
end /* otherwise */
end /* select */
/* got match -- write results. */
foo=stream(afile,'c','open')
if abbrev(foo,'READY')=0 then do
call pmprintf(foo' ERROR in post-filter recorder: unfortunate output file : ' afile)
iterate
end
foo=stream(afile,'c','close')
astat=sockgethostbyaddr(clientaddr,'stuff.!')
cname=upper(stuff.!name)
if abbrev(cname,'STUFF.!')=1 then cname=clientaddr
adate=date() ; atime=time()
amess=crlf||date() ' ' time()||crlf
amess=amess||' Request from: ' clientaddr ' ( ' cname' )'||crlf
amess=amess||' Referer: '||thereferer||crlf
amess=amess||' File= ' used_File ' ; URL= ' sel|| crlf
amess=amess||' Message: ' amessage
call lineout afile,amess
call lineout afile
end /* end do */
return ' '